package com.yjha.lzmarathonsys.controller;

import java.util.Arrays;
import java.util.Map;

//import org.apache.shiro.authz.annotation.RequiresPermissions;
import com.yjha.lzmarathonsys.dto.Param;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.yjha.lzmarathonsys.bean.TbSpecial;
import com.yjha.lzmarathonsys.service.TbSpecialService;
import com.yjha.lzmarathonsys.utils.PageUtils;
import com.yjha.lzmarathonsys.utils.R;



/**
 * 专题表
 *
 * @author æ­å°
 * @email 1971240051@qq.com
 * @date 2025-05-13 15:07:07
 */
@Api(tags = "专题表")
@RestController
@RequestMapping("lzmarathonsys/tbspecial")
// @CrossOrigin
public class TbSpecialController {
    @Autowired
    private TbSpecialService tbSpecialService;

    /**
     * 列表
     */
    @PostMapping("/list")
    @ApiOperation("获取专题列表")
    //@RequiresPermissions("lzmarathonsys:tbspecial:list")
    public R list(@RequestBody Param params){
        PageUtils page = tbSpecialService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 列表
     */
    @PostMapping("/listSpecialAll")
    @ApiOperation("获取专题列表")
    //@RequiresPermissions("lzmarathonsys:tbspecial:list")
    public R listSpecialAll(){
        R r = tbSpecialService.listSpecialAll();

        return r;
    }

    /**
     * 信息
     */
    @GetMapping("/info/{tbId}")
    @ApiOperation("获取专题详情")
    //@RequiresPermissions("lzmarathonsys:tbspecial:info")
    public R info(@PathVariable("tbId") Integer tbId){
		TbSpecial tbSpecial = tbSpecialService.getById(tbId);

        return R.ok().put("tbSpecial", tbSpecial);
    }

    /**
     * 保存
     */
    @PostMapping("/save")
    @ApiOperation("保存专题")
    //@RequiresPermissions("lzmarathonsys:tbspecial:save")
    public R save(@RequestBody TbSpecial tbSpecial){
		R r = tbSpecialService.saveTbSpecial(tbSpecial);

        return r;
    }

    /**
     * 修改
     */
    @PostMapping("/update")
    @ApiOperation("修改专题")
    //@RequiresPermissions("lzmarathonsys:tbspecial:update")
    public R update(@RequestBody TbSpecial tbSpecial){
		R r = tbSpecialService.updateByIdTbSpecial(tbSpecial);

        return r;
    }

    /**
     * 删除
     */
    @PostMapping("/delete")
    @ApiOperation("删除专题")
    //@RequiresPermissions("lzmarathonsys:tbspecial:delete")
    public R delete(@RequestBody Integer[] tbIds){
        R r = tbSpecialService.removeByIdsDelete(Arrays.asList(tbIds));

        return r;
    }

}
